<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    img {
      position: absolute;
      top: 2px;
    }
  </style>
  
</head>

<body>
  <img src="images/angel.gif" alt="">
  <script>
    var pic = document.querySelector('img');
    //每一次触发鼠标移动 都更改图片的位置 位置为鼠标的位置
    document.addEventListener('mousemove', function (e) {
      var x = e.pageX;
      var y = e.pageY;
      console.log(x,y)
      pic.style.left = x - 50 + 'px';
      pic.style.top = y - 40 + 'px';
    });
  </script>
</body>

</html>